package com.guchenbo.bigdata.hadoop;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

import java.io.IOException;

/**
 * @author guchenbo
 */
public class HdfsDemo {

    public static void main(String[] args) throws IOException {
        Configuration conf = new Configuration();
        conf.set("fs.defaultFS","hdfs://vnode102:9000");
        FileSystem fileSystem = FileSystem.get(conf);
        System.out.println(fileSystem);
        System.out.println(fileSystem.getHomeDirectory());
        System.out.println(fileSystem.getScheme());

        fileSystem.mkdirs(new Path("lib"));
        Path src = new Path("bigdata/target/bigdata-1.0.0.jar");
        Path desc = new Path("lib");
        fileSystem.copyFromLocalFile(src, desc);
        fileSystem.close();
    }
}
